home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctutor2.zip / MACRO.C < prev    next >
C/C++ Source or Header  |  1987-07-04  |  555b  |  19 lines

  1.                                         /* Chapter 6 - Program 2 */
  2. #define WRONG(A) A*A*A      /* Wrong macro for cube */
  3. #define CUBE(A) (A)*(A)*(A) /* Right macro for cube */
  4. #define SQUR(A) (A)*(A)     /* Right macro for square */
  5. #define START 1
  6. #define STOP  9
  7.  
  8. main()
  9. {
  10. int i,offset;
  11.  
  12.    offset = 5;
  13.    for (i = START;i <= STOP;i++) {
  14.       printf("The square of %3d is %4d, and its cube is %6d\n",
  15.               i+offset,SQUR(i+offset),CUBE(i+offset));
  16.       printf("The wrong of  %3d is %6d\n",i+offset,WRONG(i+offset));
  17.    }
  18. }
  19.